set(APP lstm)
project(${APP})
set(CMAKE_CXX_STANDARD 17)

if(CMAKE_BUILD_TYPE STREQUAL "")
	set(CMAKE_BUILD_TYPE "Debug")
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
	set(CMAKE_BUILD_TYPE "Release")
endif()

if (BUILD_SHARED_LIBS)
    add_definitions(-DBUILD_SHARED_LIBS)
    if (CMAKE_COMPILER_IS_GNUCXX AND NOT MINGW)
       add_definitions("-fPIC")
    endif()
    set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()



SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)       # 设置了可执行文件的输出目录
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)               # 设置可执行文件的输出目录
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)                  # 设置库文件的输出目录


if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
	message("redhat.")
	set(OpenCV_DIR "/usr/local")
	find_package(OpenCV REQUIRED)
	set(OpenCV_LIB_DIR ${OpenCV_INSTALL_PATH}/lib)
	message(STATUS "OpenCV版本: ${OpenCV_VERSION}")
	message(STATUS "    头文件目录：${OpenCV_INCLUDE_DIRS}")
	message(STATUS "    库文件目录：${OpenCV_LIB_DIR}")
	message(STATUS "    库文件列表：${OpenCV_LIBS}")
	include_directories(${OpenCV_INCLUDE_DIRS})

	link_libraries("/usr/local/lib64/libopencv_dnn.so.405")
	link_libraries("/usr/local/lib64/libopencv_imgproc.so.405")
	link_libraries("/usr/local/lib64/libopencv_core.so.405")
	link_libraries("/usr/local/lib64/libopencv_imgcodecs.so.405")
	link_libraries("/usr/local/lib64/libopencv_wechat_qrcode.so.405")
	link_libraries("/usr/local/lib64/libjsoncpp.so")
	link_libraries("/usr/lib64/libuuid.so")
	link_libraries("/usr/lib64/libzbar.so.0.2.0")
	link_libraries("/usr/lib64/libz.so.1.2.7")

	message(STATUS "onnxruntime")
	include_directories("/home/wangsp/onnxruntime-linux-x64-1.11.1/include")
	link_libraries("/home/wangsp/onnxruntime-linux-x64-1.11.1/lib/libonnxruntime.so")

	message(STATUS "mupdf")
	include_directories("/usr/local/include")
	include_directories("/usr/local/include/mupdf")


	AUX_SOURCE_DIRECTORY(./src SOURCES)
	include_directories (${PROJECT_SOURCE_DIR}/DataFrame)               # 附加头文件目录
	include_directories (${PROJECT_SOURCE_DIR}/ThirdPartyLibraries)     # 附加头文件目录
	include_directories (${PROJECT_SOURCE_DIR}/include)                 # 附加头文件目录
	link_directories(${PROJECT_SOURCE_DIR}/lib)

	add_subdirectory(${PROJECT_SOURCE_DIR}/ThirdPartyLibraries/ZDataFrame_static)
	add_executable(${APP} ${SOURCES})
	TARGET_LINK_LIBRARIES(${APP} ndframe_static pthread event event_pthreads)
else()
	message("==================windows.======================")
	include_directories ("D:/opencv455_cuda/install/include")            # 附加头文件目录
	include_directories ("D:/opencv455_cuda/install/include/opencv2")    # 附加头文件目录
	include_directories ("D:/onnxruntime-win-x64-1.11.1/include")

	link_libraries("D:/opencv455_cuda/install/x64/vc16/lib/opencv_dnn455.lib")
	link_libraries("D:/opencv455_cuda/install/x64/vc16/lib/opencv_imgproc455.lib")
	link_libraries("D:/opencv455_cuda/install/x64/vc16/lib/opencv_core455.lib")
	link_libraries("D:/opencv455_cuda/install/x64/vc16/lib/opencv_imgcodecs455.lib")

	include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include)           # 附加头文件目录
	include_directories (${PROJECT_SOURCE_DIR}/include)                 # 附加头文件目录
	link_directories(${PROJECT_SOURCE_DIR}/lib)

	set(SOURCE_FILES
			src/dataset.cpp
			src/Conv2d.cpp
			src/LSTM_WIN.cpp

			include/ActivationFunction.h
			include/ActivationFunction_avx2.h
			include/dataset.h
			include/Tensor.h
			include/Matrix.h
			include/Matrix_avx2.h
			include/type_alias.h
			include/Conv2d.h
	)
	add_executable(${APP} ${SOURCE_FILES})
	TARGET_LINK_LIBRARIES(${APP})
endif()

